package org.jeecg.modules.generator.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.generator.entity.SysGenerateTabColumn;

import java.util.List;
import java.util.Map;

public interface SysGenerateTabColumnMapper extends BaseMapper<SysGenerateTabColumn> {


    @Select("select * from (select field_name,column_name,field_item_name,field_item_value from SYS_GENERATE_FIELD_INFO where  table_id = #{tableId}) pivot(max(field_item_value) for field_item_name in(${pivotParams}))")
    List<SysGenerateTabColumn> queryByColumnInfoByTbableId(@Param("tableId") String tableId, @Param("pivotParams") String pivotParams);

    List<Map<String,Object>> queryByFieldItemInfoByTbableId(@Param("tableId") String tableId, @Param("pivotParams") String pivotParams);

    @Select("select field_item_name from SYS_GENERATE_FIELD_INFO group by field_item_name")
    List<String> queryAllfieldItemNameByTbableId();
}
